#include <iostream>
#include <list>
#include <string>
#include <fstream>
#include <vector>
using  namespace std;

void split(const std::string& s, std::vector<std::string>& v, const std::string& c)
{
    std::string::size_type pos1, pos2;
    pos2 = s.find(c);
    pos1 = 0;
    while(std::string::npos != pos2)
    {
        v.push_back(s.substr(pos1, pos2-pos1));

        pos1 = pos2 + c.size();
        pos2 = s.find(c, pos1);
    }
    if(pos1 != s.length())
        v.push_back(s.substr(pos1));
}

int main() {
    ifstream in("filename");
    string str;
    vector<string> curr;
    while(getline(in,str))
    {
        split(str,curr, ",");
        curr.clear();
    }
    list<pair<int , string>> pre_index;
    std::cout << "Hello, World!" << std::endl;
    return 0;
}













#include <fstream>

class Channel
{
public:
    Channel(ostream* o = &std::cout) : trace_file(o) {}
    //重定向输出流
    ~Channel()
    {
    }
    void Reset(ostream* o = &std::cout)
    {
        trace_file = o;
    }
    ostream& getInstance()
    {
        return *trace_file;
    }
private:
    ostream* trace_file;
};




int main()
{


    std::string s = "12344";
    ofstream file("./logxxx");
    Channel ch(&file);
    ch.getInstance() << "123444444"<<endl;
    
}

